package homework;

public class choose {
    public static void main(String[] args) {
        int[] array = {1, 10, 2, 45, 23, 78, 14};

        for (int i = 0; i < array.length - 1; i++) {
            int maxIndex = 0;
            for (int j = 1; j < array.length - i; j++) {
                if (array[j] > array[maxIndex]) {
                    maxIndex = j;
                }
            }
            int temp = array[array.length - 1 - i];
            array[array.length - 1 - i] = array[maxIndex];
            array[maxIndex] = temp;
        }
        for (int i : array) {
            System.out.println(i);
        }
    }
}







